@extends('admin.defaults.head')
@section('title','标题')
@section('body')

{{--请在下面编辑body 内容--}}



<div class="layui-form" lay-filter="layuiadmin-form-role" id="layuiadmin-form-role" style="padding: 20px 30px 0 0;">

    <div class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md4">


                <div class="layui-card">
                    <div class="layui-card-header">数据库和控制器名称</div>
                    <div class="layui-card-body">
                        <div class="layui-form-item">


                            <div class="layui-form-item">
                                <label class="">mysql (如果有直已这个为主，如果没值直接链接数据库获取)</label>
                                <div class="">
                                    <textarea placeholder="请输入 mysql CREATE TABLE `wolive_visiter`  或者   json " style="height: 100px"  class="layui-textarea" v-model="mysqltable"></textarea>
                                    <!-- <input type="text" name="title" lay-verify="title" v-model="strcode" autocomplete="off" placeholder="请输入加密密钥" class="layui-input">-->
                                </div>
                            </div>

                            <button type="button" class="layui-btn layui-btn-normal" @click="get_tables()">mysql生成设置列表</button>




                            <div class="layui-col-lg12">
                                <label class="layui-form-label">数据库：</label>
                                <div class="layui-input-block">
                                    <select name="table" lay-verify="required" lay-filter="dbtable">
                                        <option value="">请先选择数据表</option>
                                        <option v-for="table,tablekey in tables" :value="tablekey">@{{ tablekey }}</option>

                                    </select>
                                </div>
                            </div>
                            <div class="layui-col-lg12" style="margin-top: 10px">
                                <label class="layui-form-label">控制器：</label>
                                <div class="layui-input-block">
                                    <input type="text" name="controller" lay-verify="required" v-model="controller"  placeholder="" autocomplete="off" class="layui-input">
                                    <p style="color: #999999">
                                        ps:控制器目录app/Http/Controller/
                                    </p>
                                </div>
                            </div>
                            <div class="layui-col-lg12" style="margin-top: 10px">
                                <label class="layui-form-label">名称：</label>
                                <div class="layui-input-block">
                                    <input type="text" name="controllername" lay-verify="required" v-model="controllername"  placeholder="" autocomplete="off" class="layui-input">
                                </div>
                            </div>

                        </div>
                    </div>
                </div>


                <div class="layui-card">
                    <div class="layui-card-header">自动生成路由</div>
                    <div class="layui-card-body">
                        <div class="layui-form-item">
                            {{--<label class="layui-form-label">复选框</label>--}}
                            <div class="layui-input-block">

                                <div class="layui-unselect layui-form-checkbox" @click="routes.add=!routes.add" :class="routes.add?'layui-form-checked':''"><span>增</span><i class="layui-icon layui-icon-ok"></i></div>
                                <div class="layui-unselect layui-form-checkbox" @click="routes.edit=!routes.edit"  :class="routes.edit?'layui-form-checked':''"><span>改</span><i class="layui-icon layui-icon-ok"></i></div>
                                <div class="layui-unselect layui-form-checkbox" @click="routes.dele=!routes.dele"  :class="routes.dele?'layui-form-checked':''"><span>删</span><i class="layui-icon layui-icon-ok"></i></div>
                                <div class="layui-unselect layui-form-checkbox" @click="routes.list=!routes.list"  :class="routes.list?'layui-form-checked':''"><span>查</span><i class="layui-icon layui-icon-ok"></i></div>
                            </div>
                        </div>
                    </div>
                </div>




                <div class="layui-card" v-if="routes.list">
                    <div class="layui-card-header">列表功能按钮</div>
                    <div class="layui-card-body">
                        <div class="layui-form-item">
                            <label class="layui-form-label">头部按钮</label>
                            <div class="layui-input-line">
                                <input type="checkbox" name="buttons_top[]" value="add" title="新增" checked="">
                                <input type="checkbox" name="buttons_top[]" value="pldele" title="批量删除" checked="">


                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">右边按钮</label>
                            <div class="layui-input-line">
                                <input type="checkbox" name="buttons_rigth[]" value="filter" title="列筛选" checked="">
                                <input type="checkbox" name="buttons_rigth[]" value="exports" title="导出" checked="">
                                <input type="checkbox" name="buttons_rigth[]" value="print" title="打印" checked="">

                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">表格行</label>
                            <div class="layui-input-line">


                                <input type="checkbox" name="buttons_row[]" value="dele" title="删除" checked="">
                                <input type="checkbox" name="buttons_row[]" value="edit" title="修改" checked="">
                                <input type="checkbox" name="buttons_row[]" value="info" title="详情" checked="">

                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">其他</label>
                            <div class="layui-input-line">


                                <input type="checkbox" name="buttons_show_so" value="1" title="展开搜索栏" checked="">


                            </div>
                        </div>
                    </div>

                </div>


                <div class="layui-card" v-if="routes.list">
                    <div class="layui-card-header">添加列表关联表</div>
                    <div class="layui-card-body">
                        <table class="layui-table">
                            <colgroup>
                                <col width="">

                                <col width="">
                                <col width="">
                                <col>
                                <col width="50">
                            </colgroup>
                            <thead>
                            <tr>
                                <th>选择关联表</th>
                                <th>关联字段</th>
                                <th>原表字段</th>
                                <th>类型</th>
                                <th></th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr v-for="tablek,index in re_tables">


                                <td>
                                    <select name="re_tables[]" lay-verify="required" lay-filter="retable">
                                        <option value="">请先选择关联表</option>
                                        <option v-for="table,tablekey in tables" :value="tablekey+'-'+index">@{{ tablekey }}</option>

                                    </select>
                                </td>
                                <td>
                                    <select name="re_tables_fi[]" lay-verify="required" lay-filter="">
                                        <option v-for="table,tablekey in tablek" :value="'a'+index+'.'+tablekey">@{{ 'a'+index+'.'+tablekey }}</option>

                                    </select>
                                </td>
                                <td>
                                    <select name="re_tables_fi_old[]" lay-verify="required" lay-filter="">
                                        <option v-for="table,tablekey in select_table" :value="tablekey">@{{ tablekey }}</option>

                                    </select>
                                </td>
                                <td>
                                    <select name="re_tables_type[]">
                                        <option value="Inner">Inner</option>
                                        <option value="Left">Left</option>
                                        <option value="Rigth">Rigth</option>
                                    </select>
                                </td>
                                <td>
                                    <button type="button" @click="remove_re_tables(index)" class="layui-btn layui-btn-primary layui-btn-sm">
                                        <i class="layui-icon">&#xe640;</i>
                                    </button>
                                </td>
                            </tr>


                            </tbody>
                        </table>

                        <div>
                            <button @click="add_re_tables" class="layui-btn layui-btn-normal layui-btn-sm">添加关联表</button>
                        </div>
                    </div>
                </div>


            </div>
            <div class="layui-col-md8" >



                <div class="layui-card" v-if="routes.add || routes.edit">
                    <div class="layui-card-header">新增表单类型</div>
                    <div class="layui-card-body">

                        <table class="layui-table">
                            <colgroup>
                                <col width="30">

                                <col width="150">
                                <col width="150">
                                <col>
                                <col>
                            </colgroup>
                            <thead>
                            <tr>
                                <th><input type="checkbox"  lay-skin="primary"></th>
                                <th>字段</th>
                                <th>名称</th>
                                <th>输入框类型</th>
                                <th>其他关联状态（类型单选、多选、下拉）有效</th>
                                <th width="100">验证类型</th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr v-for="vlaue,key in select_table" v-if="['id','updated_at','created_at'].indexOf(key)==-1">
                                <td><input name="add_fied[]" :value="key" type="checkbox" checked  lay-skin="primary"></td>
                                <td v-text="key"></td>
                                <td>
                                    <input type="text" name="add_title[]" v-model="vlaue.title"  lay-verify="identity" placeholder="" autocomplete="off" class="layui-input">
                                </td>
                                <td>
                                    <select name="add_type[]">
                                        <option v-for="vtype,type in input_types" :value="type" v-text="vtype"></option>

                                    </select>
                                </td>
                                <td>
                                    <input type="text" name="add_status[]"   lay-verify="identity" placeholder="" autocomplete="off" class="layui-input">
                                    <span style="color:#c3c3c3">
                                        1、固定状态如:(0=关闭,1=开启)
                                    <p>
                                    2、读表选择如表sl_admin填：table=admin,key=id,value=title
                                   </span>

                                </td>
                                <td>
                                    <select name="add_checktype[]">
                                        <option value="">非必填</option>
                                        <option v-for="vtype,type in check_types" :value="type" :selected="vlaue.isnotnull && type=='required'" v-text="vtype"></option>

                                    </select>
                                </td>
                            </tr>


                            </tbody>
                        </table>


                    </div>
                </div>




                <div class="layui-card" v-if="routes.list">
                    <div class="layui-card-header">列表显示字段</div>
                    <div class="layui-card-body">

                        <table class="layui-table">
                            <colgroup>
                                <col width="30">

                                <col width="150">
                                <col width="150">
                                <col width="150">
                                <col>
                                <col width="80">
                                <col width="80">
                                <col width="80">
                            </colgroup>
                            <thead>
                            <tr>
                                <th><input type="checkbox"  lay-skin="primary"></th>
                                <th>字段</th>
                                <th>名称</th>
                                <th>类型</th>
                                <th>固定类型状态(类型选择状态，或链接有效)</th>
                                <th>累计</th>
                                <th>排序</th>
                                <th>搜索</th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr v-for="vlaue,key in list_table">

                                <td><input name="list_fied[]" type="checkbox" :value="vlaue.fied" :checked="vlaue.check"  lay-skin="primary"></td>
                                <td v-text="vlaue.fied"></td>
                                <td>
                                    <input  name="list_title[]" type="text" v-model="vlaue.title" name="identity" v-model="vlaue.title" lay-verify="identity" placeholder="" autocomplete="off" class="layui-input">
                                </td>
                                <td>
                                    <select name="list_type[]">
                                        <option v-for="vtype,type in list_types" :value="type" :selected="vlaue.isnotnull && type=='required'" v-text="vtype"></option>

                                    </select>
                                </td>
                                <td>
                                    <input type="text" name="list_type_status[]"   lay-verify="identity" placeholder="" autocomplete="off" class="layui-input">
                                    <span style="color:#c3c3c3">
                                        1、固定状态如:(0=关闭,1=开启)
                                    <p>
                                    2、链接如：/tool/api/index?id=
                                   </span>

                                </td>
                                <td><input  name="list_total[]" type="checkbox" v-model="vlaue.total" value="1"  lay-skin="primary"></td>
                                <td><input  name="list_order[]" type="checkbox" v-model="vlaue.order" value="1"  lay-skin="primary"></td>
                                <td><input  name="list_so[]" type="checkbox" v-model="vlaue.so" value="1"  lay-skin="primary"></td>

                            </tr>


                            </tbody>
                        </table>


                    </div>
                </div>








            </div>

        </div>
    </div>



    <div class="layui-form-item layui-layout-admin">
        <div class="layui-input-block">
            <div class="layui-footer" style="left: 0;">

                <button @click="deleMake" class="layui-btn layui-btn-primary">删除旧的</button>
                <button class="layui-btn" lay-filter="LAY-user-role-submit" @click="submit" id="LAY-user-role-submit">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                <template v-for="data,i in filePath">

                    <template v-for="data2,i2 in data">

                        <button v-if="data2!=''"   class="layui-btn layui-btn-normal layui-btn-sm" @click="lookFile(data2)"  v-text="i+':'+i2"></button>
                        <!--<a v-if="data2!=''"   class="layui-btn layui-btn-normal layui-btn-sm"  :href="'view-source:file:///'+data2"  v-text="i+':'+i2"></a>-->
                    </template>

                </template>



            </div>
        </div>
    </div>


</div>


{{--上方body内容结束   请在下面编辑script 内容--}}

@endsection
@section('script')
<script src="/style_js_admin/viewjs/defaults/tool.blade.js"></script>

@endsection
